<?php

	function lookup($conn, $catname) {
		$sql = "select id from category where name = '$catname';";
		$result = mysql_query($sql);
		if ($result) {
		
		}
		
	}

	$servername = 'www.michelona.com';
	$database = 'michelona_com';
	$username = 'michelona_web';
	$password = '4everlover';
	$conn = mysql_connect($servername, $username, $password);
	if (!$conn) die ('Cannot connect to database: ' . mysql_error());
	


	$filename = '/HostingSpaces/chrisvel/michelona.com/data/devscripts/getcat.txt';
	$lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
	$numlines = count($lines);
	$cache = array();
	for ($i = 0; $i < $numlines; $i++) {
		$pieces = explode("\t", $lines[$i]);
		$numpieces = count($pieces);
		$pid = $pieces[0];
		$subcat = $pieces[$numpieces - 1];
		$parcat = $pieces[$numpieces - 2];
		if (!array_key_exists($subcat, $cache) {
			$cache[$subcat] = lookup($conn, $catname);
		}
	}
	$ver = phpversion();
	echo "<div>$ver</div>";
	/* 
	
	$numPieces = count($pieces);
	*/
?>